Skip to content

Fix race condition when trying to connect twice at the same time with the websockets transport #106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

leszekhanusz
Copy link
Collaborator

Connecting twice with the same client is not allowed and should raise TransportAlreadyConnected the second time.

Because of a bug in the websockets transport, if the user tries to connect twice at the same time (in different tasks), it will raise a RuntimeError (RuntimeError: cannot call recv while another coroutine is already waiting for the next message)

This PR will fix this bug which was reported in issue #105

@coveralls
Copy link

coveralls commented Jun 28, 2020

Coverage Status

Coverage increased (+0.005%) to 99.23% when pulling f51179e on leszekhanusz:fix_race_condition_in_websockets_connect into 87cc5b2 on graphql-python:master.

@leszekhanusz leszekhanusz added the type: bug An issue or pull request relating to a bug label Jun 28, 2020
@leszekhanusz leszekhanusz self-assigned this Jun 28, 2020
@leszekhanusz leszekhanusz requested a review from KingDarBoja June 28, 2020 20:36
Copy link
Contributor

@KingDarBoja KingDarBoja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome fix! 🍰

@KingDarBoja KingDarBoja merged commit 5348b0a into graphql-python:master Jun 29, 2020
@KingDarBoja KingDarBoja added this to the Version 3.0 milestone Jun 29, 2020
@leszekhanusz leszekhanusz deleted the fix_race_condition_in_websockets_connect branch July 1, 2020 15:02
leszekhanusz added a commit to leszekhanusz/gql that referenced this pull request Jul 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug An issue or pull request relating to a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Race condition when connecting with the same websockets transport twice at the same time
3 participants